package org.jeecg.modules.paycenter.channel.pufa;

import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.concurrent.TimeUnit;

public class PFUtil {

    private static final String contentType = "application/json;charset=utf-8";
    private static final String charset = "UTF-8";
    private static final OkHttpClient client = new OkHttpClient.Builder()
            .connectionPool(new ConnectionPool(500, 5, TimeUnit.MINUTES)).connectTimeout(10000, TimeUnit.MILLISECONDS)
            .readTimeout(6000, TimeUnit.MILLISECONDS).build();


    public static void main(String[] args) throws Exception{
        try {
            Request request = new Request.Builder().url("http://127.0.0.1:9900/wlhy168/paycenter/pf/test1").get().build();
            Response response = client.newCall(request).execute();
            String resBody = new String(response.body().bytes(), "UTF-8");
            System.out.println(resBody);
        } catch (ConnectException e){
            System.out.println(e.getMessage());
        }
        catch (SocketTimeoutException e){
            System.out.println(e.getMessage());
        }
    }

}
